﻿// -----------------------------------------------------------------------
// <copyright file="PlayUrlForm.cs" company="Abyssalsoft">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace Metal.CommonForms
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using Metal.Resources;

    /// <summary>
    /// Open URL dialog
    /// </summary>
    public partial class PlayUrlForm : Form
    {
        /// <summary>Stores the URL to open</summary>
        private string strURL;

        /// <summary>
        /// Initializes a new instance of the PlayUrlForm class.
        /// </summary>
        public PlayUrlForm()
        {
            this.InitializeComponent();

            this.InfoLabel.Text = MessageProvider.GetMessage("RES00034");
            this.Text = MessageProvider.GetMessage("RES00035");
        }

        /// <summary>
        /// Gets the URL introduced by the user
        /// </summary>
        public string URL
        {
            get
            {
                return this.strURL;
            }
        }

        /// <summary>
        /// Close the form
        /// </summary>
        /// <param name="sender">Object sender</param>
        /// <param name="e">Event args</param>
        private void OkButton_Click(object sender, EventArgs e)
        {
            try
            {
                // TODO: Add some validation here
                if (this.URLTextBox.Text != string.Empty)
                {
                    this.strURL = this.URLTextBox.Text;
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                Metal.User.UserMessage.ShowError(ex);
            }
        }
    }
}
